package com.nanfang51g3.ckz.adapter.ext;

import android.view.View;
import android.view.ViewGroup;

import com.nanfang51g3.ckz.R;
import com.nanfang51g3.ckz.adapter.base.BaseRecyclerViewAdapter;
import com.nanfang51g3.ckz.domain.MoneyDetailBean;

import java.util.List;

/**
 * Created by Administrator on 2016/4/19.
 */
public class MoneyDetailAdapter extends BaseRecyclerViewAdapter<MoneyDetailBean, MoneyDetailAdapter.MoneyDetailViewHolder>/* implements ItemTouchHelperAdapter*/ {
    private final int type;
    public MoneyDetailAdapter(List<MoneyDetailBean> list, int type) {
        super(list);
        this.type = type;
    }
    @Override
    protected void bindDataToItemView(MoneyDetailViewHolder myViewHolder, final MoneyDetailBean item) {
        if (type == 2) {
            myViewHolder.setBackgroundResource(R.id.iv_money_detail_type, R.mipmap.ic_yin_hang_ka);
            myViewHolder.setText(R.id.tv_money_detail_id, "银行卡");
        } else {
            myViewHolder.setBackgroundResource(R.id.iv_money_detail_type, R.mipmap.ic_ali_pay);
            myViewHolder.setText(R.id.tv_money_detail_id, "支付宝");
        }
        myViewHolder.setText(R.id.tv_money_detail_money, item.getTotal());
        myViewHolder.setText(R.id.tv_money_detail_status, item.getIs_deal().endsWith("0")?"申请中":"已交易");
        myViewHolder.setText(R.id.tv_money_detail_time, item.getDeal_time());
    }
    @Override
    public MoneyDetailViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) {
        return new MoneyDetailViewHolder(inflateItemView(viewGroup, R.layout.money_detail_item));
    }
    public class MoneyDetailViewHolder extends BaseRecyclerViewAdapter.SparseArrayViewHolder {
        public MoneyDetailViewHolder(View itemView) {
            super(itemView);
        }
    }

}
